home *** CD-ROM | disk | FTP | other *** search
/ Precision Software Appli…tions Silver Collection 4 / Precision Software Applications Silver Collection Volume 4 (1993).iso / stats / mathx30.exe / TRIANGLE.UTL < prev   
Text File  |  1991-06-09  |  9KB  |  245 lines

  1. Z''=INFO:z'''=int((z''-int(z''/10000)*10000)/1000):if z'''=0}1
  2. | TRIANGLE.UTL, Copyright 1991 by David Denker |
  3. | Box 115, Isanti, Mn. 55040 |
  4. DSP N" SORRY, THIS FILE CAN ONLY BE RUN ON MATH EXTRA!"N
  5. WAIT10:QUIT
  6. #1:Z'''=INT(Z''*.0001):IF Z'''=>300}2
  7. DSP nn; Sorry, this file must be used with MATHX V3.00 or greater!;n
  8. wait20:quit
  9. #2:DEGM
  10. TITLE= TRIANGLE PROGRAMS 
  11. #3:goff:CLS:WLCC L2f15b6
  12. HEAD B0F14"  Select by the PICK LETTER or use MOUSE or  CURSOR keys."
  13. menuu bb1bf16b11f0I;
  14.  ;!O;blique triangle 
  15.  ;!Q;uit
  16.  ;!R;ight triangle;x
  17. #6
  18. j=mlvl:on(j)g{510,7,500}:quit
  19. #7:quit
  20. #9:j''=data k{0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,3,2,0,0,0,0,0,0,0,0}:ret
  21. #32
  22. HOFF:dsp n; "M"enu, "R"edo, else quit! ;:i'=kyin
  23. if i'=77}3:if i'=109}3:if i'=82}6:if i'=114}6:quit
  24. #40:head ;  Enter 0 to quit.    Hit the F1 key for HELP;:ret
  25. #249:beep:wait4:go500
  26. #248
  27. wind wr10wc78r1c0bb1bf14b11f0" Right Triangle Program: 
  28.                                       A
  29.     Pick the two knowns               |\             A & B are angles in
  30.      and give their values.           |  \                degrees.
  31.                                     y |    \ h      At least one side must
  32.     The program will give you         |      \            be given.
  33.      the unknowns.                    |        \
  34.                                       |__________\
  35.                                     90     x      B
  36. ":RET
  37. #250
  38. CLS:GOS40:GOS248:I''=1
  39. #251
  40. a=0:b=0:h=0:x=0:y=0:$i="0":row12
  41. dsp"  Pick the first known: (A,B,x,y,h) ":$i=inp(1){400}:if $i="0"}q
  42. call 266:if c'=0}251
  43. c''=c':dsp n"  What is its value? ":i'=inp{401}
  44. if i'=0}q:if sgn i'=-1}264:call267
  45. dsp n
  46. #252
  47. $i="0":dsp "  Pick the second known: "
  48. $i=inp(1){400}:if $i="0"}q:call 266:if c'=0}252
  49. dsp n"  What is its value? ":i'=inp{401}:if i'=0}q:if sgn i'=-1}264
  50. call267
  51. c'=c''+c':if c'=24}260
  52. if c'=2}261:if c'=4}261:if c'=8}261:if c'=16}261:if c'=32}261
  53. if a=>90}263:if b=>90}263
  54. if c'<13}253:c'=c'-8
  55. #253
  56. if h=0}254:if h<=x}262:if h<=y}262
  57. #254
  58. x=data c'{,,,x,,x,sqr(h^2-y^2),,,x,y*tan a,,h*sin a}
  59. y=data c'{,,,y,,sqr(h^2-x^2),y,,,x*tan b,y,,sqr(h^2-x^2)}
  60. if h<>0}255:h=sqr(x^2+y^2)
  61. #255:if a<>0}256:a=atn(x/y):b=90-a
  62. #256
  63. dsp r12c0" A ="(a)s10n" B ="(b)s10n" x ="(x)s10n" y ="(y)s10n" h ="(h)s10n
  64. GOTO32
  65. #260:dsp n" ERROR: AT LEAST ONE SIDE MUST BE GIVEN!":goto249
  66. #261:dsp n" ERROR: A KNOWN WAS USED TWICE!":goto249
  67. #262:dsp n; ERROR: "h" must be greater than "x" or "y"!;:goto249
  68. #263
  69. dsp n" ERROR: AN ANGLE CANNOT BE EQUAL TO OR GREATER THAN 90°!":GOTO249
  70. #264:dsp n" ERROR: A KNOWN CANNOT BE NEGATIVE!":goto249
  71. #266:c'=1:if $i="x"}r:if $i="X"}r:c'=2:if $i="y"}r:if $i="Y"}r
  72. c'=4:if $i="h"}r:if $i="H"}r:c'=8:if $i="a"}r:if $i="A"}r:c'=16
  73. if $i="b"}r:if $i="B"}r:c'=0
  74. dsp of4" ERROR: MUST pick (A,B,x,y,h)!        ":beep:wait2
  75. dsp os34o:ret
  76. #267:if c'<>1}268:x=i':ret
  77. #268:if c'<>2}269:y=i':ret
  78. #269:if c'<>4}270:h=i':ret
  79. #270:if c'<>8}271:a=i':b=90-a:ret
  80. #271:b=i':a=90-b:ret
  81. #299:beep:wait4:go510
  82. #298
  83. wind bb1bf14b11f0wr9wc78r1c0" Oblique Triangle Program: 
  84.                                       A
  85.    Pick three knowns and              /\         A, B, & C are angles in
  86.      give their values.             /   \               degrees.
  87.                                 y /      \ z      At least one side must
  88.    The program will give        /         \             be given.
  89.      you the unknowns.        /____________\
  90.                              B      x       C"n:RET
  91. #300:cls:d'=0:gos40:GOS298:I''=2
  92. #301:row10:$i="0"
  93. dsp"  Pick the first known: (A,B,C,x,y,z) ":$i=inp(1){400}:if $i="0"}q
  94. call 320:if t'=0}301
  95. t''=t':dsp n"  What is its value? "
  96. i'=inp{401}:if i'=0}q:if sgn i'=-1}335:call321
  97. dsp n
  98. #302:$i="0":dsp "  Pick the second known: "
  99. $i=inp(1){400}:if $i="0"}q:call 320:if t'=0}302:t''=t''+t'
  100. dsp n"  What is its value? ":i'=inp{401}:if i'=0}q:if sgn i'=-1}335
  101. call321:dsp n
  102. #303:$i="0":dsp "  Pick the third known: "
  103. $i=inp(1){400}:if $i="0"}q:call 320:if t'=0}303:t''=t''+t'
  104. dsp n"  What is its value? ":i'=inp{401}:if i'=0}q:if sgn i'=-1}335
  105. call321
  106. if t''=56}333:if t''<>7}340
  107. if x<z}305:if x<y}305:if y+z<=x}334
  108. A=acs((y^2+z^2-x^2)/(2*y*z)):b=asn((z*sin a)/x):c=180-a-b:goto319
  109. #305
  110. if y<z}306:if x+z<=y}334
  111. c=acs((x^2+z^2-y^2)/(2*x*z)):a=asn((x*sin c)/y):b=180-c-a:goto319
  112. #306
  113. if x+y<z}334
  114. b=acs((x^2+y^2-z^2)/(2*x*y)):c=asn((y*sin b)/z):a=180-b-c:goto319
  115. #318
  116. dsp s40ns40n" A ="(a)s5" x ="(x)n" B ="(b)s5" y ="(y)n" C ="(C)s5" z ="(Z)n
  117. dsp s40n:ret
  118. #319:call318:GOTO32
  119. #320:t'=1:if $i="x"}r:if $i="X"}r:t'=2:if $i="y"}r:if $i="Y"}r
  120. t'=4:if $i="z"}r:if $i="Z"}r:t'=8:if $i="a"}r:if $i="A"}r:t'=16
  121. if $i="b"}r:if $i="B"}r:t'=32:if $i="c"}r:if $i="C"}r:t'=0
  122. dsp of4" ERROR: MUST pick (A,B,C,x,y,z)!           "o:beep
  123. wait2
  124. dsp os40o
  125. ret
  126. #321:if t'<>1}322:x=i':ret
  127. #322:if t'<>2}323:y=i':ret
  128. #323:if t'<>4}324:z=i':ret
  129. #324:if t'<>8}325:a=i':ret
  130. #325:if t'<>16}326:b=i':ret
  131. #326:c=i':ret
  132. #330
  133. dsp n" ERROR: AN ANGLE CANNOT BE EQUAL TO OR GREATER THAN 180°!":GOTO299
  134. #331:dsp n" ERROR: A KNOWN WAS USED TWICE!":goto299
  135. #333:dsp n" ERROR: AT LEAST ONE SIDE MUST BE GIVEN!":GOTO299
  136. #334:dsp n" ERROR: TRIANGLE IS NOT POSSIBLE WITH DATA GIVEN!":GOTO299
  137. #335:dsp n" ERROR: A KNOWN CANNOT BE NEGATIVE!":goto299
  138. #340:if t''>14}350:if a=>180}330
  139. t'=t''
  140. #341
  141. call342:if e'=2}331:if e'=1}334:call348:goto32
  142. #342
  143. if t'=11}345:if t'=13}347:e'=2:if t'<>14}r:e'=0:if y>z}344
  144. #343
  145. x=sqr(z*z+y*y-2*z*y*cos a):b=acs((x*x+y*y-z*z)/(2*x*y)):c=180-a-b:ret
  146. #344
  147. y'=y:y=z:z=y':call343:y'=y:y=z:z=y':y'=b:b=c:c=y':ret
  148. #345
  149. if x<y}346
  150. c=asn(y*sin a/x):b=180-a-c:z=(x*sin b)/sin a:ret
  151. #346
  152. e'=1:if asn(x/y)<a}r:e'=0
  153. c=asn((y*sin a)/x):b=180-a-c:z=(y*sin b)/sin c
  154. x''=x:y''=y:a''=a:c''=c:ROW10:COL0:call348:dsp " or"
  155. x=x'':y=y'':a=a'':c=c''
  156. c=180-c:b=180-c-a:z=(y*sin b)/sin c:ret
  157. #347
  158. y=z:d'=d'+3:call345:ret
  159. #348
  160. x'=data d'{x,y,z,x,z,y}
  161. y'=data d'{y,z,x,z,y,x}
  162. z'=data d'{z,x,y,y,x,z}
  163. a'=data d'{a,c,b,a,b,c}
  164. b'=data d'{b,a,c,c,a,b}
  165. c'=data d'{c,b,a,b,c,a}
  166. x=x':y=y':z=z':a=a':b=b':c=c'
  167. goto318
  168. #350
  169. if t''>22}355:if b=>180}330
  170. d'=1:t'=t''-19:t'=data t'{14,,11,13}:a=b:b=x:x=z:z=y:y=b:goto 341
  171. #355
  172. if t''>38}361:if t''<35}360:if c=>180}330
  173. d'=2:t'=t''-35:t'=data t'{13,,14,11}:a=c:c=x:x=y:y=z:z=c:goto 341
  174. #360
  175. if a+b=>180}334:c=180-a-b:t'=t''-25:goto365
  176. #361
  177. if t''>44}362:if a+c=>180}334:b=180-a-c:t'=t''-41:goto365
  178. #362
  179. if b+c=>180}334:a=180-b-c:t'=t''-49
  180. #365
  181. if t'<>0}366:y=(x*sin c)/sin a:z=(x*sin b)/sin a:goto319
  182. #366
  183. if t'<>1}367:z=(y*sin b)/sin c:x=(y*sin a)/sin c:goto319
  184. #367
  185. if t'<>3}331:x=(z*sin a)/sin b:y=(z*sin c)/sin b:goto319
  186.  
  187. #400
  188. wind ;
  189.  Type in the character for one
  190.  of the sides or angles of the
  191.  triangle  that  you  know the
  192.  value of.  Hit the enter key.
  193.  You  will  be  asked for that 
  194.  value next. 
  195.  
  196.  Hit any key to continue!;x:wait50:woff
  197. ON(I'')C{248,298}:quit
  198. #401
  199. wind ;
  200.  Enter  the  value  of the side
  201.  or  angle  you selected on the
  202.  previous line.   You may enter
  203.  a number, a variable or a math 
  204.  expression.  Hit the enter key
  205.  when done.
  206.  
  207.  Hit any key to continue!;x:wait50:woff
  208. ON(I'')C{248,298}:quit
  209.  
  210. #500
  211. cls:gmod0:graf:gos505:if x'''=0}501:fc6
  212. dsp r0c0" Right Triangle Program: 
  213.                                       A
  214.     Pick the two knowns                              A & B are angles in
  215.      and give their values.                               degrees.
  216.                                      y       h      At least one side must
  217.     The program will give you                             be given.
  218.      the unknowns.
  219.  
  220.                                     90     x      B"n
  221. line x(38.5*x''')y(2*y''')ex(38.5*x''')ey(8*y''')w2
  222. line ex(49.5*x''')
  223. line y(8*y''')w1:i''=1:go251
  224. #501
  225. goff:go250
  226. #502
  227. goff:go300
  228. #505
  229. g'=vidm:x'''=0:if g'>19}r
  230. x'''=data g'{0,0,0,0,0,0,8,0,0,0,0,0,0,0,8,8,8,8,8,0}
  231. y'''=data g'{0,0,0,0,0,0,8,0,0,0,0,0,0,0,8,14,14,16,16,0}:ret
  232. #510
  233. cls:gmod0:graf:gos505:if x'''=0}502:fc6
  234. dsp r0c0" Oblique Triangle Program: 
  235.                                       A
  236.    Pick three knowns and                         A, B, & C are angles in
  237.      give their values.                                 degrees.
  238.                                 y          z      At least one side must
  239.    The program will give                                be given.
  240.      you the unknowns.
  241.                              B      x       C"n
  242. line x(38.5*x''')y(2*y''')ex(30*x''')ey(7*y''')w2
  243. line ex(44*x''')
  244. line x(30*x''')y(7*y''')w1:i''=2:go301
  245.